tests/installed: support TESTS filter
authorJonathan Lebon <jlebon@redhat.com>
Thu, 1 Feb 2018 22:07:36 +0000 (22:07 +0000)
committerAtomic Bot <atomic-devel@projectatomic.io>
Fri, 2 Feb 2018 22:36:49 +0000 (22:36 +0000)
Lifted from rpm-ostree. Makes iterating on a single test much faster.
Example use:

    TESTS=label-selinux ./ostree/tests/installed/run.sh

Closes: #1442
Approved by: cgwalters

tests/installed/run.sh

index 02e1a7f968df99a5419e8f85e1270876417786a8..38a9d769869359345a35472aa391dd37d4c2d14e 100755 (executable)
@@ -4,6 +4,14 @@ set -xeuo pipefail
 
 dn=$(dirname $0)
 for tn in ${dn}/itest-*.sh; do
+    if [ -n "${TESTS+ }" ]; then
+      tbn=$(basename "$tn" .sh)
+      tbn=" ${tbn#itest-} "
+      if [[ " $TESTS " != *$tbn* ]]; then
+        echo "Skipping: ${tn}"
+        continue
+      fi
+    fi
     echo Executing: ${tn}
     ${tn}
 done